// ==UserScript==
// @name         A营评论区自动加载
// @namespace    https://gitee.com/Zeng_YL
// @source       https://gitee.com/Zeng_YL/scratch_addon/tree/master/A营评论区自动加载
// @updateURL    https://gitee.com/Zeng_YL/scratch_addon/raw/master/A营评论区自动加载/userscript.user.js
// @version      0.2
// @description  自动点击A营评论区“载入更多”按钮。
// @author       zengyl
// @match        https://*.gitblock.cn/*
// @match        https://*.aerfaying.com/*
// @license      MIT
// @grant        none
// ==/UserScript==

(function () {
    var oldURL = "";
    setInterval(function () {
        if (oldURL != location.pathname) {
            oldURL = location.hash.includes("commentId") ? "" : location.pathname;
            return;
        }
        var btnE = $(".comment-panel_load-more_18oUL>.btn");
        if (btnE.length < 1) return;
        var clH = $(window).height();
        var ofTop = btnE.offset().top - $(document).scrollTop();
        if (ofTop < 3 * clH) btnE.click();
    }, 300);
    $(document).on("click", ".comment-panel_load-more_18oUL>.btn", function () {
        oldURL = location.pathname;
    });
})();